package edu.java.texbooks.scjp.collections.test07.set.student;

public class Student implements Comparable<Student> {

	// --- Instance Variables --------------------------------------------------
	private String name = null;
	private int facNum = 0;
	private double marks = 0;

	// --- Constructors --------------------------------------------------------
	public Student(String name, int facNum) {
		super();
		this.name = name;
		this.facNum = facNum;
	}

	public Student(String name, int facNum, double marks) {
		super();
		this.name = name;
		this.facNum = facNum;
		this.marks = marks;
	}

	// --- Methods -------------------------------------------------------------

	@Override
	public String toString() {
		return "[ " + getName() + ",\t" + getFacNum() + ",\t" + getMarks()
				+ ",\t" + hashCode() + " ]\n";
	}

	@Override
	public int compareTo(Student student) {
		if (student == null) {
			throw new IllegalArgumentException(
					"Incorrect input of student object. ");
		}
		// compare by Name
		return getName().compareTo(student.getName());
	}

	// --- Getters and Setters -------------------------------------------------
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getFacNum() {
		return facNum;
	}

	public void setFacNum(int facNum) {
		this.facNum = facNum;
	}

	public double getMarks() {
		return marks;
	}

	public void setMarks(double marks) {
		this.marks = marks;
	}

}
